﻿namespace AspNetCoreWebApi
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //创建web主机建造者对象
            WebApplicationBuilder webApplication = WebApplication.CreateBuilder();
            webApplication.WebHost.UseKestrel();
            webApplication.Services.AddControllers();
            webApplication.Services.AddSwaggerGen();
            //webApplication.Host.
            //创建web主机
            WebApplication application = webApplication.Build();
            application.UseSwagger();
            application.UseSwaggerUI();
            application.Use(async (context, next) => {
                var path = context.Request.Path;
                await next();
            });
            application.MapControllers();
            application.Urls.Add("http://localhost:5009");
            //运行主机
            application.Run();
        }
    }
}
